import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
//import set from '@dfeidao/atom-web/local/set';
import render from '@dfeidao/atom-web/render/render';
import p001 from './p001';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import set from '@dfeidao/atom-web/local/set';

export default async function a001(fd: IFeidaoAiBrowserComponent, nos: string, d_name: string, d_level: string) {
	const no = fd.data.node.querySelector<HTMLInputElement>('[data-id="name"]');
	no.value = d_name;
	const dd = d_level;

	const res = await nodejs('risk-point/zj-000010/s002', {
		filter: {
			optional_value: d_level,
		}
	});

	const render_data = Object.assign({ dd }, res);

	render(fd, render_data, p001, 'p001', 'inner');

	// 编辑窗口
	const n = fd.data.node.querySelector<HTMLDivElement>('[data-id="edit"]');
	set_node_cls(n, 'display-n', false);
	set(fd, 'nos', nos);
}
